<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>test</title>  
	<link href="common-messager/common.messager.css" rel="stylesheet" type="text/css" />
	<link href="common-dialoger/common.dialoger.css" rel="stylesheet" type="text/css" />
	<link href="common-validator/common.validator.css" rel="stylesheet" type="text/css" />
	<style type="test/css">
	html{color:blue;}
	</style>
</head>
<body> <div style="height:400px;">
</div>
<form id="sssss">
<input type="checkbox" name="sss" validate-option="{required:required}">
<input type="checkbox" name="sss" validate-option="{required:required}">
<p>
    <br/>
    <span style="color:red;"> text</span>
</p> 
<div id="test1" class="common-dialoger"></div>
<input type="text" class="ssd.t" validate-option="{minLength:3,maxLength:15,custom:^\stt\d$}" name="tts" value="" style="width:300px;" >
<button type="submit" id="hhh" >jjjjj</button> 
</form>
<script type="text/javascript" src="yenbay.common.utils.js"></script> 
<script type="text/javascript" src="common-messager/common.messager.js"></script> 
<script type="text/javascript" src="common-validator/common.validator.js"></script>
 
<script type="text/javascript"> 
  var m1 = {},m2={};
  m1.put("tt","sdf");
  m2.put("tt","11");
  alert(m2.get("tt"));
var inputs=document.getElementsByTagName("input"),test="2.121"; 
 var forma=document.getElementById("sssss"),b=  document.getElementById("hhh");
 utils.bind(b,"click",function(e){
        var t=validator.validate(forma);
       alert(t);
       debugger;
      });

/*console.info(dialoger(test1).open("http://www.baidu.com"));*/
/*var m= messager.prompt("请输入你的生日",function(value){
  		alert(value);
  	},"1997-01-02");*/
//var k=utils.bind(inputs,"click",function(e){
 
 //addEvents(inputs[1],"click",function(){
	//messager.pop(this.value,this,false,"right top");
	 //messager.pop(this.value,this);
	/*messager.confirm("是不是",function(accept){
		if(accept){
			alert("ok");
		}else{
			alert("not ok");
		}
	});*/ 
  	//messager.alert(this.value); 
  	/*messager.prompt("请输入你的生日",function(value){
  		alert(value);
  	},"1997-01-02");*/
  	/* messager.info(this.value,true,function(){
  		 
  	}); */
	//messager.success(this.value, 6000);
	 //messager.warning(this.value);
	/*messager.error(this.value,null,function(){
		setTimeout(function(){
			alert(document.body.outerHTML);
	},15000);
});*/
	/* messager.show((new Date().getTime()),false,function(){

	}); */
 	//messager.show((new Date().getTime()));
  	//messager.tips(this.value);
 //});
 //});
	</script>
	<script>
/**
 *截取数字或者数字字符串到指定位数小数
 *@param {number/string} [value] [要截取的数字字符串或者数字] 必须
 *@param {number} [keepPoint] [保留几位小数] 必须
 *@param {boolean} [ifRound] [是否四舍五入] 默认否
 */
function numberToString(value,keepPoint,ifRound){ 
    var _value="0";
    if(typeof keepPoint == "number" && keepPoint > 0){
        if(value){
            _value=value.toString().trim(); 
            _value.replace(/^(\d+)(\.{0,1})(\d*)$/g,function(s0,s1,s2,s3){ 
                var c=s3 || ""; 
                if(s2){
                    //有小数点 
                    if(typeof s3!="undefined"){
                        while(c.length<(keepPoint+1)){
                            c =c+"0";
                        }//多加一位用于判定 
                        c = c.match(new RegExp("\\d{"+(keepPoint+1)+"}","g"))[0];
                        var last=c.replace(new RegExp("\\d{"+keepPoint+"}(\\d)","g"),function(s0,s1){
                            return Number(s1 || "0");
                        }); 
                        c=c.substring(0,keepPoint);  
                        if(ifRound){
                            //四舍五入
                            if(last>=5){
                                c = (Number(c)+1).toString();
                            }
                        } 
                    } 
                }  
                _value=(s1 || "0")+"."+(c||"0"); 
            }); 
        }
        //补齐小数位数  
        var regx = new  RegExp("^(\\d\\.)(\\d+)","g"); 
        var temp_int="",temp_str="";
        _value.replace(regx,function(s0,s1,s2){
            temp_int = s1;
            temp_str = s2;
            while(temp_str.length<keepPoint){
                temp_str += "0";
            }
        });
        _value=temp_int+temp_str;
    }else{
        //取整 
        if(value){
            _value = value.toString().trim(); 
        }   
        //截掉
        value && value.toString().replace(/^\s*(\d+)\./g,function(s0,s1){
            _value=s1;
        });  
    }
    return _value;
}

 
	</script>
</body>
</html>